package Utils;
/**
 * @author Shihai Shi
 * @date 2013-2-5
 * @version V1.0
 */
import java.awt.GridBagConstraints;
import java.awt.Insets;

public class GBC extends GridBagConstraints
{
   /**
	 * 
	 */
	private static final long serialVersionUID = 1L;

//Initialize left top corner 
   public GBC(int gridx, int gridy)
   {
      this.gridx = gridx;
      this.gridy = gridy;
   }

   //Initialize left top corner and size of component
   public GBC(int gridx, int gridy, int gridwidth, int gridheight)
   {
      this.gridx = gridx;
      this.gridy = gridy;
      this.gridwidth = gridwidth;
      this.gridheight = gridheight;
   }

   //Set alignment
   public GBC setAnchor(int anchor)
   {
      this.anchor = anchor;
      return this;
   }

   //This field is used when the component's display area is larger than 
   //the component's requested size. 
   //It determines whether to resize the component, and if so, how. 
   public GBC setFill(int fill)
   {
      this.fill = fill;
      return this;
   }

   //Specifies how to distribute extra horizontal and vertical space. 
   public GBC setWeight(double weightx, double weighty)
   {
      this.weightx = weightx;
      this.weighty = weighty;
      return this;
   }

   //This field specifies the external padding of the component, 
   //the minimum amount of space between the component and the edges of its display area. 
   public GBC setInsets(int distance)
   {
      this.insets = new Insets(distance, distance, distance, distance);
      return this;
   }

   //This field specifies the external padding of the component, 
   //the minimum amount of space between the component and the edges of its display area. 
   public GBC setInsets(int top, int left, int bottom, int right)
   {
      this.insets = new Insets(top, left, bottom, right);
      return this;
   }

   //This field specifies the internal padding of the component, how much space to add to the minimum width of the component.
   public GBC setIpad(int ipadx, int ipady)
   {
      this.ipadx = ipadx;
      this.ipady = ipady;
      return this;
   }
}
